<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script>
    window.onload = function () {
        var img = document.getElementsByTagName("img")[0];
        var arr = ["img/1.jpg","img/2.jpg","img/3.jpg","img/4.jpg","img/5.jpg"];
        var index = 0;
        setInterval(function () {
            index ++ ;
            if(index>arr.length-1){
                index=0;
            }
            img.src = arr[index];
        },1000);
    };
</script>
<body>
    <img src="img/1.jpg" width="350px" height="500px">
</body>
</html>